
const { apiPreFix, fileSavePath } = require('../config').server
const comController = require('../controllers/common')
module.exports = (router) => {
  /**
   * 文件上传（存到本地）
   */
  router.post(`${apiPreFix}/com/upload/loc`,async  ctx => {
    await comController.uploadLoc(ctx)
  })
  /**
   * 文件上传（前端压缩后以base64上传）
   */
  router.post(`${apiPreFix}/com/upload/base64Img`, async  ctx => {
    await comController.uploadBase64(ctx)
  })
  /**
   * 文件上传（存到七牛）
   */
  router.post(`${apiPreFix}/com/upload/qiniu`,async  ctx => {
    await comController.uploadQiNiu(ctx)
  })

  /** 小程序获取openid */
  router.get(`${apiPreFix}/com/jscode2session`,async  ctx => {
    await comController.jscode2session(ctx)
  })
}